#pragma once

class Fog {

	friend class Engine;

private:

	bool updateFlag = true;

	enum {
		LINEAR,
		EXP,
		EXP2
	};

	unsigned int enableFlag = false;

	glm::vec3 color = glm::vec3(0,0,0);
	
	float near = 0;
	
	float far = 1;
	
	float density = 0.f;
	
	int equation = Fog::LINEAR; // 0 - linear, 1 - exp, 2 - exp2
	
public:

	void update();

	void setEquation(const int equation);
	
	const float getEquation() const;

	const float getDensity() const;

	void setDensity(const float density);

	void setNear(const float near);
	
	void setFar(const float far);
 
	const float getNear() const;

	const float getFar() const;
	
	void setColor(float r, float g, float b);

	void setColor(const glm::vec3& color);
	
	const glm::vec3& getColor() const;

	void enable(bool state = true);
	
	void disable();
	
	const bool isEnable() const;
	
};

void Fog::update(){
	updateFlag = true;
}

void Fog::setEquation(const int equation){
	Fog::equation = equation;
	updateFlag = true;
}

const float Fog::getEquation() const{
	return equation;
}

const float Fog::getDensity() const{
	return density;
}

void Fog::setDensity(const float density){
	Fog::density = density;
	updateFlag = true;
}

const float Fog::getNear() const{
	return near;
}

const float Fog::getFar() const{
	return far;
}

void Fog::setNear(const float near){
	Fog::near = near;
	updateFlag = true;
}
	
void Fog::setFar(const float far){
	Fog::far = far;
	updateFlag = true;
}

void Fog::setColor(float r, float g, float b){
	Fog::color.r = r;
	Fog::color.g = g;
	Fog::color.b = b;
	updateFlag = true;
}

void Fog::setColor(const glm::vec3& color){
	Fog::color = color;
	updateFlag = true;
}

const glm::vec3& Fog::getColor() const{
	return color;
}

void Fog::enable(bool state){
	enableFlag = state;
	updateFlag = true;
}

void Fog::disable(){
	enableFlag = true;
	updateFlag = true;
}

const bool Fog::isEnable() const{
	return enableFlag;
}
